<?php
class DatabaseObject_Space extends DatabaseObject {
	//TODO 空间数据处理
	public $profile = null;
	
	public function __construct($db) {
		parent::__construct($db, 'spaces', 'userid');
		
		$this->add('userid', 0);
		$this->add('title', '我的空间');
		$this->add('subtitle', '现在是攒文攫字的一员了！');
		$this->add('outmenu', 255);
		$this->add('outitem', 255);
		$this->add('css', '');
		
		$this->profile = new Profile_Space($db);
	}
	
	public function getMenuList() {
		$menu = array(0 =>array(0, 'index', '首页'),
		              1 =>array(0, 'article', '文章'),
		              2 =>array(0, 'circle', '圈子'),
		              3 =>array(0, 'album', '相册'),
		              4 =>array(0, 'friend', '好友'),
		              5 =>array(0, 'attach', '附件'),
		              6 =>array(0, 'guestbook', '留言'),
		              7 =>array(0, 'application', '应用'));
		$tmp = $this->outmenu;
		
		for ($i = 0; $i < 8 ;$i++) {
		    if ($tmp % 2 == 0) {
                $menu[$i][0] = 0;
            } else {
                $menu[$i][0] = 1;
            }
            $tmp = (int)($tmp / 2);
		}
		return $menu;
	}
	
	public function getItemList() {
		$item = array(0 =>array(0, 'message', '消息'),
                      1 =>array(0, 'recent', '最近来访'),
                      2 =>array(0, 'userinfo', '个人信息'),
                      3 =>array(0, 'guestbook', '留言簿'),
                      4 =>array(0, 'album', '相册'),
                      5 =>array(0, 'article', '文章'),
                      6 =>array(0, 'attach', '附件'),
                      7 =>array(0, 'application', '应用'));
        $tmp = $this->outitem;
	    for ($i = 0; $i < 8 ;$i++) {
            if ($tmp % 2 == 0) {
                $item[$i][0] = 0;
            } else {
                $item[$i][0] = 1;
            }
            $tmp = (int)($tmp / 2);
        }
        return $item;
	}
}
?>